home *** CD-ROM | disk | FTP | other *** search
- ;void grab_box_b(box,top_x,top_y,width,depth,color);
- ; unsigned char *box,top_x,top_y,width,depth,color;
-
- EXTRN _memory_model:byte
- EXTRN _video_page:byte
-
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:_TEXT
- PUBLIC _grab_box_b
- _grab_box_b proc near
- cld ;set direction flag
- push bp ;
- mov bp,sp ;set stack frame
- push di ;
- push si ;
- cmp _memory_model,0 ;near or far?
- jle begin ;jump if near
- inc bp ;else add 2 to BP
- inc bp ;
- begin: mov bh,_video_page ;get _video_page
- cmp _memory_model,2 ;data near or far?
- jb L0 ;jump if near
- les di,dword ptr[bp+4] ;ES:DI pts to byte array
- add bp,2 ;inc BP since dword ptr
- jmp short L00 ;jump ahead
- L0: mov ax,ds ;shift DS to ES
- mov es,ax ;
- mov di,[bp+4] ;
- L00: mov dl,[bp+6] ;topleft column in DL
- dec dl ;count from 0
- mov dh,[bp+8] ;topleft row in DH
- dec dh ;count from 0
- mov al,[bp+10] ;width in AL
- mov ah,[bp+12] ;depth in AH
- mov bl,[bp+14] ;fill attribute in BL
- mov bp,ax ;copy in BP
- sub cx,cx ;clear CX
- mov cl,al ;copy width into CX
- mov si,cx ;move to SI as counter
- mov ah,2 ;function to set cursor
- int 10h ;set the cursor
- push dx ;save start-of-row pos
- L1: mov ah,8 ;func to read char-attri
- int 10h ;read the char and attri
- stosw ;write to the save area
- mov ah,9 ;func to write char-attri
- mov al,32 ;use space char for fill
- mov cx,1 ;number of chars to write
- int 10h ;write the fill character
- dec si ;decrement width counter
- jz L3 ;to next row if last col
- inc dl ;incre cursor col
- L2: mov ah,2 ;function to set cursor
- int 10h ;reset the cursor
- jmp short L1 ;go do next character
- L3: pop dx ;new row: get old pos
- mov cx,bp ;width-depth to CX
- dec ch ;decre depth counter
- jz L4 ;quit if finished
- mov bp,cx ;resave depth-width
- sub ch,ch ;CX = width
- mov si,cx ;transfer to SI as ctr
- inc dh ;increase row number
- push dx ;save for next time
- jmp short L2 ;go set new cursor pos
- L4: pop si ;
- pop di ;
- pop bp ;
- cmp _memory_model,0 ;quit
- jle quit ;
- db 0CBh ;RET far
- quit: ret ;RET near
- _grab_box_b endp
- _TEXT ENDS
- END